package cn.test3d.activity;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import cn.test3d.R;

/**
 * Main menu activity
 * 
 * @author Lee
 */
public class SplashActivity extends ListActivity {

	class ItemVo {
		public String filename;
		public Class<?> cls;
		public String label;

		public ItemVo(String $label, Class<?> $class, String $filename) {
			label = $label;
			cls = $class;
			filename = $filename;
		}
	}

	private ItemVo[] _items = {
			new ItemVo("桌面悬浮", Table3DActivity.class, "Table3DActivity.java"),
			new ItemVo("在skybox里移动", MoveCameraActivity.class,
					"ExampleAccelerometer.java"),
			new ItemVo("测试", TestActivity.class, "TestActivity.java") };

	@Override
	public void onCreate(Bundle savedInstanceState) {
		String[] strings = new String[_items.length];
		for (int i = 0; i < _items.length; i++) {
			strings[i] = _items[i].label;
		}

		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash_activity);
		setListAdapter(new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, strings));

		registerForContextMenu(getListView());

	}

	@Override
	public void onListItemClick(ListView parent, View v, int position, long id) {
		this.startActivity(new Intent(this, _items[position].cls));
	}

}
